<!--
 * @FileDescription 磁航向
 * @Author 杨宇翔
 * @Date 20220713 11:44:01
 * @LastEditors 杨宇翔
 * @LastEditTime 20220713 11:44:01
-->
<template>
    <div class="mag-heading">
        <div class="img-container">
            <!-- <img src="/static/InertialNavigation/pic_2_bg.png"> -->
            <div class="arrow">
                <!-- <img src="/static/InertialNavigation/ic_2_arrow.png"> -->
            </div>
        </div>
        <div class="information">
            <span>磁航向</span>
            <span>{{ Math.round(mag * Math.pow(10, 7)) / Math.pow(10, 7) }}°</span>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ProtocolComponent } from './InertialNavigationComponent';
import { computed } from 'vue';

const mag = computed(() => ProtocolComponent.Default.Frame.MagHeading)
const transformValue = computed(() => `translate(-50%, -50%) rotateZ(${ProtocolComponent.Default.Frame.MagHeading}deg)`)
</script>

<style scoped>
.mag-heading {
    position: absolute;
    right: 4rem;
    bottom: 4rem;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.chart {
    width: 20rem;
    height: 20rem;
}

.information {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    gap: 2rem;
}

span {
    color: #81859C;
    font-size: 1.8rem;

    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    line-height: 2.7rem;
}

span:last-of-type {
    color: #B1B1D4;
    font-size: 1.8rem;
    text-align: center;
    line-height: 2.9rem;

    opacity: 0.5;
}

.img-container {
    position: relative;
}

.img-container>img {
    width: 15rem;
    height: 15rem;
}

.arrow {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: v-bind(transformValue);

    width: 9.6rem;
    height: 9.6rem;

    text-align: center;
}

.arrow>img {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);

    width: 1.8rem;
    height: 1.8rem;
}
</style>